package com.zhiwei.most.ext.views

import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import com.blankj.utilcode.util.ColorUtils
import com.blankj.utilcode.util.SizeUtils
import com.zhiwei.most.R
import com.zhiwei.most.swipepanel.ConstraintLayoutSwipePanel

/**
 * Create by zhiweizhu on 2022/2/28
 */
fun ConstraintLayoutSwipePanel.setSwipePanel(edgeSize: Int = SizeUtils.dp2px(80f),
                                             @DrawableRes src: Int = R.mipmap.base_back,
                                             @ColorRes color: Int = R.color.color_2d2d2d,
                                             onSwipeListener : (Int) -> Unit
                                             ){
    setLeftDrawable(src)
    setLeftEdgeSize(edgeSize)
    setLeftCenter(true)
    setLeftSwipeColor(ColorUtils.getColor(color))
    setOnFullSwipeListener {
        close(it)
        onSwipeListener.invoke(it)
    }
}